function messagebox(message,title,event,obj,url,width,height,imgsrc)
{
	var e = event || window.event;
	var width = width || "450px";	
	if(!isNaN(width)) width = parseInt(width,10) + "px";
	var height = height || "320px";
	if(!isNaN(height)) height = parseInt(height,10) + "px";
	var bodyHeight = (parseInt(height,10) - 20) + "px";
	
	var title = title || "";
	var url = url || null;
	var message = message || null;
	var obj = obj || null;
	var imgsrc = imgsrc || "../images/coos/dialogclose.gif";
	
	var shadowDiv = document.createElement("div");
	shadowDiv.style.cssText = "z-index: 10001;background-color: #000; filter: alpha(opacity=40);opacity: 0.4; left: 0px; width: 100%; position: absolute; top: 0px; height: 100%;  display:none;";
	shadowDiv.id = "messagebox_shadowDiv";
	
	var boxDiv = document.createElement("div");
	boxDiv.style.cssText = "position:absolute;left:0px;top:0px;width:" + width + ";height:" + height + "; background-color:#FFFFFF; z-index:10003;display:none; border: #709cd2 1px solid;";
	boxDiv.id = "messagebox_boxDiv";
	var boxTitle = '<div style="width:100%;height:20px;background: #739ED6;padding-top:2px;border-bottom: #cccccc 1px solid;"><span style="float:left;text-align:left;margin-left:5px;font-size:14px;color:#FFFFFF;font-weight:bold;width:auto;" id="messagebox_boxDiv_title">' + title + '</span><span style="float:right;width:30px;text-align:right;cursor:pointer;"><img src="'+ imgsrc + '" width="15" height="15"/>&nbsp;</span></div>';
	var boxbody_ifr = '<iframe id="messagebox_Ifr" name="messagebox_Ifr" src="" frameborder="0" scrolling="auto" height=' + bodyHeight + ' width="100%"></iframe>';
	var boxbody_div = '<div id="messagebox_bodydiv" style="height:' + bodyHeight + 'width:100%;padding:2px;"></div>';
	
	boxDiv.innerHTML = boxTitle;
	
	this.displayBox = function(title)
	{

		if(title)
		{
			coos.$id("messagebox_boxDiv_title").innerHTML = title;
		}
		
		if(coos.$id("messagebox_boxDiv") && coos.$id("messagebox_shadowDiv"))
		{
			coos.$id("messagebox_boxDiv").style.display = "";
			coos.$id("messagebox_shadowDiv").style.display = "";
			return ;
		}
	};
	
	this.removeBox = function()
	{
		document.body.removeChild(coos.$id("messagebox_boxDiv"));
		document.body.removeChild(coos.$id("messagebox_shadowDiv"));
	};
	
	this.setTitle = function(sTitle)
	{
		if(coos.$id("messagebox_boxDiv_title") && sTitle)
		{
			coos.$id("messagebox_boxDiv_title").innerHTML = sTitle;
		}
	};
	
	this.createBox = function()
	{
		if(url)
		{
			boxDiv.innerHTML = boxTitle + boxbody_ifr;
			document.body.appendChild(boxDiv);
			if (url.indexOf ("?") > 0)
				url = url + "&random=" + new Date().getTime();
			else
				url = url + "?random=" + new Date().getTime();
			
			coos.$id("messagebox_Ifr").src = url;
		}
		else if(message)
		{
			boxDiv.innerHTML = boxTitle + boxbody_div;
			document.body.appendChild(boxDiv);
			coos.$id("messagebox_bodydiv").innerHTML = message;
		}
		else if(obj)
		{			
			document.body.appendChild(boxDiv);
			boxDiv.appendChild(obj);
		}
		document.body.appendChild(shadowDiv);
		var obj_box = coos.$id("messagebox_boxDiv");
		//clientY clientX是相对页面的,screenY screenX是相对屏幕的，对于在iframe里面点击必须用screenY才正确
		//保证不超出屏幕
		var tempwidth = parseInt(e.screenX,10) + parseInt(obj_box.style.width,10);
		if(tempwidth > coos.window.width())
		{
			obj_box.style.left = (parseInt(e.screenX + document.body.scrollLeft) - parseInt(obj_box.style.width,10)) + "px";
		}
		else
		{
			obj_box.style.left = (parseInt(e.screenX + document.body.scrollLeft,10) + 5) + "px";
		}
		//屏幕高度包括浏览器头部的高度(一般情况为110)
		if(e.screenY > (parseInt(obj_box.style.height,10)+110))
		{
			obj_box.style.top = (parseInt(e.screenY + document.documentElement.scrollTop,10) - parseInt(obj_box.style.height,10) - 15) + "px";
		}
		else
		{
			obj_box.style.top = (parseInt(e.screenY + document.documentElement.scrollTop,10)-110) + "px";
		}
		
		var ds = coos.$id("messagebox_shadowDiv");
		ds.style.width = (parseInt(obj_box.style.width,10) + 9) + "px";
		ds.style.height = (parseInt(obj_box.style.height,10) + 14) + "px";
		ds.style.left = (parseInt(obj_box.style.left,10) - 4) + "px";
		ds.style.top = (parseInt(obj_box.style.top,10) - 4) + "px";
		
		this.displayBox(title);
		obj_box.onclick = function(){removeMessagebox();}
	};
	
	this.createBox();
	

}

function removeMessagebox()
{
	try
	{
		document.body.removeChild(coos.$id("messagebox_boxDiv"));
		document.body.removeChild(coos.$id("messagebox_shadowDiv"));
	}
	catch(e){}
}